package com.ztw.yygh.cmn.controller;

import com.ztw.yygh.cmn.service.ScheduleService;
import com.ztw.yygh.common.result.Result;
import com.ztw.yygh.model.hosp.Schedule;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/admin/hosp/schedule")
@Api(tags = "schedule")
public class ScheduleController {
    @Resource
    private ScheduleService scheduleService;
    //根据医院编号 和科室编号，查询排班规则数据
    @GetMapping("getScheduleRule/{page}/{limit}/{hoscode}/{depcode}")
    public Result getScheduleRule(@PathVariable long page,
                                  @PathVariable long limit,
                                  @PathVariable String hoscode,
                                  @PathVariable String depcode){
        Map<String,Object> map=scheduleService.getRuleSchedule(page, limit, hoscode, depcode);
        return Result.ok(map);
    }
    //排班详情
    @GetMapping("getScheduleDetail/{hoscode}/{depcode}/{workDate}")
    public Result getScheduleDetail(@PathVariable String hoscode,
                                     @PathVariable String depcode,
                                     @PathVariable String workDate){
        List<Schedule> list =scheduleService.getScheduleDetail(hoscode,depcode,workDate);
        return Result.ok(list);
    }
}
